<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
use think\facade\Route;

//免登陆路由
Route::group(function () {

    //手机号登陆
    Route::post('login','Staff/login');
    Route::get('captcha','Verify/index');
    Route::get('system/store','Store/storeList');
    Route::post('home/upload','Home/upload');
    Route::post('install/isInstall', 'Install/isInstall');
    Route::post('install/index', 'Install/index');
    Route::post('config/index','config/index');
})->middleware(\app\http\middleware\AllowOrigin::class);


//登陆路由
Route::group(function () {
    Route::get('system/menu','Menu/index');
    Route::post('system/menu/add','Menu/add')
        ->middleware(\app\http\middleware\AdminLog::class,'添加菜单');
    Route::post('system/menu/edit','Menu/edit')
        ->middleware(\app\http\middleware\AdminLog::class,'修改菜单');
    Route::post('system/menu/del','Menu/del')
        ->middleware(\app\http\middleware\AdminLog::class,'删除');

    Route::post('config/timing','Config/Timing');

    Route::post('config/edit','config/edit');

    Route::post('home/index','Home/index');
    Route::get('auth/user','Staff/user');
    Route::get('system/user','Staff/userList');
    Route::get('system/role','Role/roleList');
    Route::post('system/role/page','Role/rolePage');
    Route::post('system/role/add','Role/add')
        ->middleware(\app\http\middleware\AdminLog::class,'添加角色');
    Route::post('system/role/edit','Role/edit')
        ->middleware(\app\http\middleware\AdminLog::class,'编辑角色');
    Route::post('system/roleMenu','Role/roleMenu');
    Route::put('system/roleMenu/roleMenuEdit','Role/roleMenuEdit')
        ->middleware(\app\http\middleware\AdminLog::class,'修改角色权限菜单');
    Route::post('system/user/add','Staff/addStaff')
        ->middleware(\app\http\middleware\AdminLog::class,'添加账号');
    Route::post('system/user/update','Staff/staffUpdate')
        ->middleware(\app\http\middleware\AdminLog::class,'修改后台管理员');
    Route::post('system/user/password','Staff/password')
        ->middleware(\app\http\middleware\AdminLog::class,'修改后台管理员密码');
    Route::get('user/user','user/userList');
    Route::post('user/user/password','user/password')

        ->middleware(\app\http\middleware\AdminLog::class,'修改用户管理员密码');
    Route::post('user/user/updateAccount','Staff/updateAccount')->middleware(\app\http\middleware\AdminLog::class,'修改账号信息');
    Route::post('user/userInfo','user/userInfo');
    Route::post('user/user/status','user/status')
        ->middleware(\app\http\middleware\AdminLog::class,'修改用户状态');
    Route::Post('user/setTopUser', 'User/setTopUser')
        ->middleware(\app\http\middleware\AdminLog::class,'修改用户上级');
    Route::Post('user/setAmount', 'User/setAmount')
        ->middleware(\app\http\middleware\AdminLog::class,'修改用户上级');




    Route::post('home/orderStatistics','Home/orderStatistics');
    Route::post('home/amountStatistics','Home/amountStatistics');
    Route::post('home/payWayStatistics','Home/payWayStatistics');
    Route::post('home/amountTotal','Home/amountTotal');
    Route::post('home/payWay','Home/payWay');
    Route::post('home/financeStatistics','Home/financeStatistics');
    Route::post('home/packageStatistics','Home/packageStatistics');
    Route::post('home/statistics','Home/statistics');
    Route::post('home/rechargeStatistics','Home/rechargeStatistics');

    Route::post('message/index','Message/index');
    Route::post('message/edit','Message/editMessage')
        ->middleware(\app\http\middleware\AdminLog::class,'修改消息模板id');;
    Route::post('message/status','Message/status')
        ->middleware(\app\http\middleware\AdminLog::class,'修改消息模板状态');;
    Route::post('message/templateContent','Message/templateContent');


    Route::group(function () {
        Route::post('coupon/addCoupon', 'Coupon/addCoupon')
            ->middleware(\app\http\middleware\AdminLog::class,'添加优惠券');
        Route::post('coupon/editCoupon', 'Coupon/editCoupon')
            ->middleware(\app\http\middleware\AdminLog::class,'编辑优惠券');
        Route::post('coupon/upCouponStatus', 'Coupon/upCouponStatus')
            ->middleware(\app\http\middleware\AdminLog::class,'修改优惠券状态');
        Route::post('coupon/couponList', 'Coupon/couponList');
        Route::post('coupon/userCouponList', 'Coupon/userCouponList');
        Route::post('coupon/receiveCoupon', 'Coupon/receiveCoupon')     ->middleware(\app\http\middleware\AdminLog::class,'领取优惠券');;
        Route::post('coupon/userAuthorityCoupon', 'coupon/userAuthorityCoupon');

    });

    Route::group(function () {
        Route::post('classify/classifyList', 'Classify/classifyList')
            ->middleware(\app\http\middleware\AdminLog::class,'商品分类');
        Route::post('classify/addClassify', 'Classify/addClassify')
            ->middleware(\app\http\middleware\AdminLog::class,'添加分类');
        Route::post('classify/editClassify', 'Classify/editClassify')
            ->middleware(\app\http\middleware\AdminLog::class,'编辑分类');
        Route::post('classify/upClassify', 'Classify/upClassify')
            ->middleware(\app\http\middleware\AdminLog::class,'修改分类状态');
    });

    Route::group(function () {
        Route::post('addmenu', 'HomeMenu/addMenu')
            ->middleware(\app\http\middleware\AdminLog::class,'添加公众号菜单');
        Route::post('editmenu', 'HomeMenu/editMenu')
            ->middleware(\app\http\middleware\AdminLog::class,'修改公众号菜单');
        Route::post('savemenu', 'HomeMenu/savemenu')
            ->middleware(\app\http\middleware\AdminLog::class,'推送菜单');
        Route::post('delmenu', 'HomeMenu/delMenu')
            ->middleware(\app\http\middleware\AdminLog::class,'删除公众号菜单');
        Route::post('menu', 'HomeMenu/menu');

    });

    Route::group(function () {
        Route::post('package/userPackage', 'Package/userPackage');
        Route::post('package/packageList', 'Package/packageList');
        Route::post('package/packageBuyLog', 'Package/packageBuyLog');
        Route::post('package/addPackage', 'Package/addPackage')
            ->middleware(\app\http\middleware\AdminLog::class,'添加套餐卡');
        Route::post('package/editPackage', 'Package/editPackage')
            ->middleware(\app\http\middleware\AdminLog::class,'编辑套餐卡');
        Route::post('package/usePackage', 'Package/usePackage')
            ->middleware(\app\http\middleware\AdminLog::class,'核销套餐卡');
        Route::post('package/upPackageStatus', 'Package/upPackageStatus')
            ->middleware(\app\http\middleware\AdminLog::class,'修改套餐卡状态');
        Route::post('package/useLog', 'Package/useLog');
        Route::post('package/UserPackageInfo', 'Package/UserPackageInfo');
        Route::post('package/discount', 'Package/discount');
        Route::post('package/packageUseLog', 'Package/packageUseLog');
    });
    Route::group(function () {
        // 订单
        Route::post('order/goodsOrderList', 'Order/goodsOrderList');
        Route::post('order/packageOrderList', 'Order/packageOrderList');
        Route::post('order/goodsOrderInfo', 'Order/goodsOrderInfo');
        Route::post('order/rechargeOrderList', 'Order/rechargeOrderList');
        Route::post('order/amountLog', 'Order/amountLog');
        Route::post('order/amountLogInfo', 'Order/amountLogInfo');
        Route::post('order/rechargeOrder', 'Order/rechargeOrder');
        Route::post('order/withdrawalList', 'Order/withdrawalList');
        Route::post('order/createGoodsOrder', 'Order/createGoodsOrder')
            ->middleware(\app\http\middleware\AdminLog::class, '购买商品');
        Route::post('order/withdrawalReject', 'Order/withdrawalReject')
            ->middleware(\app\http\middleware\AdminLog::class, '提现驳回');

        Route::Post('order/withdrawalPass', 'Order/withdrawalPass')
            ->middleware(\app\http\middleware\MerchantLog::class,'提现通过');
        Route::post('order/createPackageOrder', 'Order/createPackageOrder')
            ->middleware(\app\http\middleware\AdminLog::class, '购买套餐卡');

        Route::post('order/upAddress', 'Order/upAddress')
            ->middleware(\app\http\middleware\AdminLog::class, '修改用户收货地址');;
        Route::post('order/completeGoodsOrder', 'Order/completeGoodsOrder')
            ->middleware(\app\http\middleware\AdminLog::class, '完成订单');;

        Route::post('order/express', 'Order/express')
            ->middleware(\app\http\middleware\AdminLog::class,'添加订单快递信息');;
        Route::post('order/confirmReturns', 'Order/confirmReturns')
            ->middleware(\app\http\middleware\AdminLog::class,'退货');;


        Route::group(function () {
            Route::post('goods/goodsList', 'Goods/goodsList');
            Route::post('goods/goodsInfo', 'Goods/goodsInfo');
            Route::post('goods/gooodsDiscount', 'Goods/gooodsDiscount');
            Route::post('goods/consumptionDiscount', 'Goods/consumptionDiscount');
            // 商品管理
            Route::post('goods/addGoods', 'Goods/addGoods')
                ->middleware(\app\http\middleware\AdminLog::class,'添加商品');
            Route::post('goods/editGoods', 'Goods/editGoods')
                ->middleware(\app\http\middleware\AdminLog::class,'修改商品');
            Route::post('goods/upGoodsStatus', 'Goods/upGoodsStatus')
                ->middleware(\app\http\middleware\AdminLog::class,'修改商品状态');
        });
        Route::post('log/index', 'Log/index');

        Route::group(function () {
            Route::post('poster/posterList', 'Poster/posterList');
            Route::post('poster/addPoster', 'Poster/addPoster')
                ->middleware(\app\http\middleware\AdminLog::class, '添加轮播图');
            Route::post('poster/editPoster', 'Poster/editPoster')
                ->middleware(\app\http\middleware\AdminLog::class, '编辑轮播图');
            Route::post('poster/delPoster', 'Poster/delPoster')
                ->middleware(\app\http\middleware\AdminLog::class, '删除轮播图');
        });
        Route::group(function () {
            Route::post('template/templateList', 'Template/templateList');
            Route::post('template/upTemplate', 'Template/upTemplate')
                ->middleware(\app\http\middleware\AdminLog::class,'首页模板编辑');
        });
        Route::group(function () {
            Route::post('module/moduleList', 'Module/moduleList');
            Route::post('module/editModule', 'Module/editModule')
                ->middleware(\app\http\middleware\AdminLog::class,'模块编辑');
            Route::post('module/upModuleStatus', 'Module/upModuleStatus')
                ->middleware(\app\http\middleware\AdminLog::class,'修改模块状态');

        });

        Route::group(function () {
            Route::Post('pay/addPayAmount', 'Pay/addPayAmount')
                ->middleware(\app\http\middleware\AdminLog::class,'添加支付金额配置');;
            Route::Post('pay/editPayAmount', 'Pay/editPayAmount')
                ->middleware(\app\http\middleware\AdminLog::class,'修改支付金额配置');;
            Route::Post('pay/delPayAmount', 'Pay/delPayAmount')
                ->middleware(\app\http\middleware\AdminLog::class,'删除支付金额配置');;;
            Route::Post('pay/payAmount', 'Pay/payAmount');
            Route::Post('pay/setStatus', 'Pay/setStatus');

        });

        Route::group(function () {
            Route::post('level/addLevel', 'Level/addLevel')
                ->middleware(\app\http\middleware\AdminLog::class,'添加会员等级');
            Route::post('level/levelList', 'Level/levelList');
            Route::post('level/editLevel', 'Level/editLevel')
                ->middleware(\app\http\middleware\AdminLog::class,'编辑会员等级');
        });

        Route::group(function (){
            Route::post('sign/signLog', 'Sign/signLog');
            Route::post('sign/signConfig', 'Sign/signConfig');
            Route::post('sign/setSignConfig', 'Sign/setSignConfig')
                ->middleware(\app\http\middleware\AdminLog::class,'修改签到配置');
        });
        Route::group(function (){
            Route::post('store/merchantRole', 'Store/storeRole');
            Route::post('store/storeList', 'Store/storeList');
            Route::post('store/myStaff', 'Store/myStaff');
            Route::post('store/addStore', 'Store/addStore')->middleware(\app\http\middleware\AdminLog::class,'添加门店');;
            Route::post('store/editStore', 'Store/editStore')->middleware(\app\http\middleware\AdminLog::class,'修改门店信息');;
            Route::post('store/upStoreStatus', 'Store/upStoreStatus')->middleware(\app\http\middleware\AdminLog::class,'修改门店信息');;
            Route::post('store/storeInfo', 'Store/storeInfo');

            Route::post('store/delStaff', 'Store/delStaff')->middleware(\app\http\middleware\AdminLog::class,'删除员工');
            Route::post('store/upPassword', 'Store/upPassword')->middleware(\app\http\middleware\AdminLog::class,'修改员工密码');
            Route::post('store/addStaff', 'Store/addStaff')->middleware(\app\http\middleware\AdminLog::class,'添加员工');
            Route::post('store/addPrinter', 'Store/addPrinter');
            Route::post('store/editPrinter', 'Store/editPrinter');
            Route::post('store/printerList', 'Store/printerList');
            Route::post('store/printing', 'Store/printing');
            Route::post('store/delPrinting', 'Store/delPrinting');


        });
        Route::group(function (){
            Route::post('log/imgLog', 'Log/imgLog');
            Route::post('log/uploadImg', 'Log/uploadImg');
            Route::post('log/uploadDel', 'Log/uploadDel');
        });

        Route::group(function (){
            Route::post('log/imgLog', 'Log/imgLog');
            Route::post('log/uploadImg', 'Log/uploadImg');
            Route::post('log/uploadDel', 'Log/uploadDel');
        });
        Route::group(function (){
            Route::post('user/commission', 'User/commission');
            Route::post('user/integral', 'User/integral');
            Route::post('user/balance', 'User/balance');

        });

            Route::group(function () {
            Route::post('addBargaining', 'Bargaining/addBargaining');
            Route::post('editBargaining', 'Bargaining/editBargaining');
            Route::post('upGinseng', 'Bargaining/upGinseng');
            Route::post('upStatus', 'Bargaining/upStatus');
            Route::post('bargainingList', 'Bargaining/bargainingList');
        });
    });
})->middleware(\app\http\middleware\AllowOrigin::class)
    ->middleware(\app\http\middleware\AdminCheckToken::class)
    ->middleware(\app\http\middleware\AuthVerify::class);



